package nyist.media.config.shiro;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

/**
 * 身份信息
 * @author dcf
 * @date  2018/12/23
 */
@Getter
@Setter
@NoArgsConstructor
public class Principal implements Serializable {
    private static final long serialVersionUID = -1746217467448074227L;

    /** "身份信息"参数名称 */
    public static final String PRINCIPAL_ATTRIBUTE_NAME = Principal.class.getName() + ".PRINCIPAL";

    /** 登录信息redis key前缀 */
    public static final String ADMIN_AUTH_REDIS_KEY_PREFIX = "oye:admin:auth:";

    /** 图形验证码的随机文本redis key 前缀 */
    public static final String ADMIN_CAPTCHA_REDIS_KEY_PREFIX = "oye:admin:captcha:";

    private Long id;

    private String username;

    private String name;

    public Principal(Long id, String username, String name){
        this.id = id;
        this.name = name;
        this.username = username;
    }

    @Override
    public String toString() {
        return name;
    }

}
